Return to doc.sitecore.com

Valid for Sitecore 5.3.1
Accessing Field Values via XSLT.
Prev Next

This article shows how each field type is stored in the database and provides information on how each data type value can be accessed.

Sitecore always stores field values as plain text in the appropriate Sitecore database (in the Value column of the Fields table).

Displaying Raw Values

It is always possible to extract the raw field value of an item using the XslHelper.fld function (sc:fld), as shown below.

<xsl:value-of select="sc:fld('My Field',.)"/>

This may work very well with titles and other simple data types, but will not always provide the desired results, as more complex types are stored in various formats within the field. For instance, link types are stored as XML:

<link linktype="internal" url="/Home/History/Old activities" target="" id="{CB2BC023-C9CF-4086-811E-0952ADFA5AF9}" />

The following table provides an example of each field type value as it is stored in the Sitecore database.

Field Type

Example

checkbox

1

checklist

{E00D9E00-2582-4022-88AE-151CE3CD7C41}|{858D25B3-B8A6-4ED1-B6F8-B52C4CC0EFDF}

date

20051003T120000

datetime

20051003T163256

file

/images/extimages/outh gif

html

This is some <strong>example</strong> HTML content.

icon

/sitecore/shell/Themes/standard/carousel.png

image

<image alt="Alternate text" width="150" height="150" hspace="4" vspace="4" mediaid="{539587C7-1F36-4D94-A10D-FFFAF079B746}" mediapath="/images/hist_gunung100px jpg" showineditor="1" usethumbnail="1" src="/SdnArchive/upload/images/hist_gunung100px.jpg"/>

internal link

/sitecore/content/Home/Sample Forms

layout

<r ><d id="{FE5D7FDF-89C0-4D99-9AA3-B5FBD009C9F3}" l="{14030E9F-CE92-49C6-AD87-7D49B50E42EA}"><r id="{493B3A83-0FA7-4484-8FC9-4680991CF743}" ph="content" ds="" par="Param1=Value1" cac="1" vbd="1" vbu="1" /></d><d id="{46D2F427-4CE5-4E1F-BA10-EF3636F43534}" l="{14030E9F-CE92-49C6-AD87-7D49B50E42EA}"><r id="{5D104030-657E-48DA-B032-0F9BB1A3C671}" ph="content" ds="" par="" /><r id="{E0E16B09-0176-4756-978C-63459B19F8ED}" ph="content" ds="/sitecore/content/Home/Other selectable document" par="Param1=Paramvalue1&Param2=Paramvalue2" cac="1" vbdev="1" vbqs="1" /></d></r>

link

<link text="Sitecore" linktype="external" url="http://www.sitecore.net" anchor="" title="go to Sitecore" class="Normal" target="_blank" />

lookup

{858D25B3-B8A6-4ED1-B6F8-B52C4CC0EFDF}

memo

This is a test.

multilist

{632511FF-5E1D-4820-8379-CA5923328603}|{E00D9E00-2582-4022-88AE-151CE3CD7C41}

password

asdjlk

reference

{0D45476E-F67C-4F14-9B4E-C26D53F6EC48}

security

extranet|{A365D840-553C-4E76-9DFD-AC3BB58E80A1}|8||extranet|{24918F00-C53F-40D9-A8EB-DD25EBB131F9}|8448||

server file

/global.html

text

Text field

tree

{DB290BF5-0D3E-41FA-8C0F-DDBBE4EEF68B}

tristate

1

valuelookup

updater


Casting Field Types

It is possible, however, to cast field values to a specific field type, so that the output meets expectations. The examples of this article show how to achieve this.


Prev Next